
/* start /web-platform/scripts/web-platform/helpers/jquery.constrainedAffix.js*/
(function($){'use strict';function _relayoutWhenReady(callback){if(window.requestAnimationFrame){return window.requestAnimationFrame(callback);}else{return window.setTimeout(callback,1);}}
$.fn.constrainedAffix=function(options){var repaintId=null;var $elements=this;var _options=$.extend({},options);if(_options.margin){_options.marginTop=_options.marginBottom=_options.margin;}
function updateAffix(){repaintId=null;var scrollTop=window.pageYOffset;var $constraintBox=$(_options.constraintBox);var constraintBottomScrolled=($constraintBox.offset().top+$constraintBox.innerHeight())-scrollTop;$elements.each(function(){var $this=$(this);var $contents=$this.find(_options.contents);var topScrolled=($this.offset().top-scrollTop);var contentsHeight=$contents.height()+_options.marginBottom;var marginTopVal=(typeof _options.marginTop=='function')?_options.marginTop():_options.marginTop;if(topScrolled>=marginTopVal){if($contents.hasClass('floating')){$contents.removeClass('floating').css('top','').trigger('un-affix');}}else{if(!$contents.hasClass('floating')){$contents.addClass('floating').trigger('affix');}
if((constraintBottomScrolled-marginTopVal)<contentsHeight){$contents.css('top',(constraintBottomScrolled-contentsHeight)+'px');}else{$contents.css('top',marginTopVal+'px');}}});}
$(window).on('scroll.constrainedAffix resize.constrainedAffix',function(){if(!repaintId){repaintId=_relayoutWhenReady(updateAffix);}});repaintId=_relayoutWhenReady(updateAffix);return this;};})(jQuery);

/* end /web-platform/scripts/web-platform/helpers/jquery.constrainedAffix.js*/

/* start /web-platform/scripts/web-platform/helpers/debounced-updater.js*/
function DebouncedUpdater(options){'use strict';var _options=_.extend({callbacks:[],doInitialUpdate:true},options,{repaintId:null});function _updateHandler(){_options.repaintId=null;_options.callbacks.forEach(function(cb){cb();});}
this.doUpdate=function(){if(!_options.repaintId){_options.repaintId=DebouncedUpdater.relayoutWhenReady(_updateHandler);}};if(_options.doInitialUpdate){this.doUpdate();}}
DebouncedUpdater.relayoutWhenReady=function(updateHandler){'use strict';if(window.requestAnimationFrame){return window.requestAnimationFrame(updateHandler);}else{return window.setTimeout(updateHandler,1);}};

/* end /web-platform/scripts/web-platform/helpers/debounced-updater.js*/

/* start /web-platform/scripts/web-platform/component/media-query-detection.js*/
SOE.MediaQueryDetection=(function(){var currentSize;var currentBreakPoint;var breakPoints=[{size:480,value:"xs"},{size:768,value:"xs"},{size:992,value:"sm"},{size:1200,value:"md"},{size:1e9,value:"lg"}];var detectBreakpointChange=function(){var newBreakPoint=detectBreakpoint();if(currentBreakPoint!==newBreakPoint.size){currentBreakPoint=newBreakPoint.size;$(window).trigger("soe.breakpointChanged",{breakpoint:newBreakPoint.value});}};var detectBreakpoint=function(){var k;currentSize=window.innerWidth||document.documentElement.clientWidth;for(k=0;k<breakPoints.length;k++){if(currentSize<breakPoints[k].size){break;}}
return breakPoints[k];};var init=function(){currentBreakPoint=detectBreakpoint().size;$(window).on("resize",detectBreakpointChange);$(window).trigger("soe.breakpointSet",{breakpoint:detectBreakpoint().value});};return{init:init,detectBreakpoint:detectBreakpoint};})();SOE.MediaQueryDetection.init();

/* end /web-platform/scripts/web-platform/component/media-query-detection.js*/

/* start /scripts/_pages/ps4beta.js*/
$(document).ready(function(){'use strict';function scrollPageTo(id){var el=document.getElementById(id);var isMobile=SOE.MediaQueryDetection.detectBreakpoint().value==='xs';var elTop=$(el).offset().top;var langRect=document.getElementById('languageMenu').getBoundingClientRect();var scrollTarget=isMobile?elTop-(langRect.bottom+15):elTop;$('html, body').animate({scrollTop:scrollTarget},'fast');}
$(document).on('click','[data-scroll-to]',function(e){e.preventDefault();scrollPageTo(this.getAttribute('data-scroll-to'));});(function(hash){var $target;if(hash){$target=$(hash);if($target.length>0){scrollPageTo(hash.slice(1));}}})(window.location.hash);$('#heroMarkupLinks a').appendTo($('#heroMarkupLinks').empty().removeClass('hidden'));if(!globs.wdl.wdlCookDNT){SOE.MediaModal.setupYouTube({linkSelector:'.video-link'});}
$('#languageMenu a').on('click',function(e){e.preventDefault();var newLocale=this.getAttribute('data-locale');if(newLocale!=globs.soelocale){window.location.search=SOE.Utils.setSearchParam(window.location.search,'locale',newLocale);}});$('.ps4-beta-signup').constrainedAffix({contents:'#languageMenu',constraintBox:'.ps4-beta-signup',marginTop:function(){switch(SOE.MediaQueryDetection.detectBreakpoint().value){case'xs':case'sm':case'md':return 15;default:return 28;}},marginBottom:15});function triggerAnimations(){var windowHeight=window.innerHeight;$('.will-animate, .animate').each(function(i,el){var bounds=el.getBoundingClientRect();var revealThreshold=el.getAttribute('data-reveal-threshold');revealThreshold=revealThreshold?parseFloat(revealThreshold):0.4;var revealFactor;revealFactor=(windowHeight-bounds.top)/bounds.height;if(revealFactor>=revealThreshold){$(el).removeClass('will-animate').addClass('animate');}else if(bounds.top>=windowHeight){$(el).addClass('will-animate').removeClass('animate');}});}
function setupStacks(){$('.stacked').removeClass('stacked');$('.stack').css({height:'auto'});$('.stack').each(function(i,el){var $el=$(el);var height=$el.outerHeight();$el.css({height:height+'px'});});}
function stackSections(){$('.stack').each(function(i,el){var $el=$(el);var bounds=el.getBoundingClientRect();$el.children().toggleClass('stacked',bounds.top<0||$el.hasClass('stacked-always'));});}
var resizeUpdater=new DebouncedUpdater({callbacks:[triggerAnimations,setupStacks,stackSections]});var scrollUpdater=new DebouncedUpdater({callbacks:[triggerAnimations,stackSections]});$(window).on('resize',function(){resizeUpdater.doUpdate();});$(window).on('scroll',function(){scrollUpdater.doUpdate();});function isEmailValid($field){var browserValidated=$field.prop('validity').valid;var regexValidated=/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test($field.val());return browserValidated&&regexValidated;}
function isFormValid(){var emailIsValid=isEmailValid($('#betaSignupEmail'));var acceptedTosPP=$('#betaSignupAcceptTosPP').is(':checked');var acceptedMarketing=$('#betaSignupMarketingOptIn').is(':checked');return emailIsValid&&acceptedTosPP&&acceptedMarketing;}
function updateFormState(){var isValid=isFormValid();$('#betaSignupSubmit').prop('disabled',!isValid);}
$('#betaSignupEmail, #betaSignupAcceptTosPP, #betaSignupMarketingOptIn').on('input change',function(){updateFormState();});function showFormWaiting(){$('#betaSignupForm input, #betaSignupForm button').prop('disabled',true);}
function showSuccess(){$('#signUp .pending').addClass('hidden');$('#signUp .success').removeClass('hidden');}
function showGeneralError(){$('#signUp .pending').addClass('hidden');$('#signUp .error').removeClass('hidden');}
$('#betaSignupForm').on('submit',function(e){e.preventDefault();if(!isFormValid()){return;}
$.ajax({url:globs.urls.appengRestUrl+'/rest/saveEmail',type:'post',dataType:'json',timeout:10000,data:{campaignId:4217556,email:$('#betaSignupEmail').val(),locale:window.DGC.ps4beta.locale,optIn:$('#betaSignupMarketingOptIn').is(':checked')?1:0,},beforeSend:showFormWaiting,success:function(data){if(data&&data.success){showSuccess();}else{showGeneralError();}},error:showGeneralError});});});

/* end /scripts/_pages/ps4beta.js*/

/* start /web-platform/scripts/web-platform/component/media-modal.js*/
window.SOE=window.SOE||{};window.SOE.MediaModal=(function(){'use strict';var YOUTUBE_FAILURE_RETRY_COUNT=3;var _numDots=5;var _dotBarAutosizeSettings=null;var _numVideoThumbs=6;var _didInit=false;var _youTubeInitStarted=false;var _youTubeInitFinished=false;var _downloadListFunc=null;var _filterFunc=null;var _originalUrl=null;var _imageInfo=null;var _youTubeVideos=null;let youTubePlayer;function _updateDotPos(idx){var $allDots=$('#dotOverflowContainer .dot');var $visibleDots=$allDots.filter(':not(.filtered)');var pageIdx=Math.floor($visibleDots.index($allDots.eq(idx))/_numDots);$allDots.removeClass('active').eq(idx).addClass('active');$('#dotOverflowContainer').stop().animate({left:pageIdx* -$('#paginationDotContainer').width()},function(){$('.modalControl').removeClass('disabled');});_updateDownloadList(idx);_updatePermalink(idx);}
function _updateDownloadList(dotIdx){if(_downloadListFunc){_downloadListFunc(_imageInfo[dotIdx].userId,$('#mediaModalDownload ul').empty());}}
function _updatePermalink(dotIdx){if(_originalUrl&&window.history.replaceState){window.history.replaceState(null,document.title,_imageInfo[dotIdx].permalinkUrl);}}
function _autosizeDotBar(){if(_dotBarAutosizeSettings){var windowWidth=window.innerWidth||document.documentElement.clientWidth;var totalDots=parseInt($('#mediaModalHeader .mediaTotal').text(),10);var widestPossibleContainer=Math.floor((windowWidth*_dotBarAutosizeSettings.maxWidth)/_dotBarAutosizeSettings.dotWidth)*_dotBarAutosizeSettings.dotWidth;var allDotsWidth=totalDots*_dotBarAutosizeSettings.dotWidth;var finalDotBarWidth=Math.min(widestPossibleContainer,allDotsWidth);var visibleDots=(finalDotBarWidth/_dotBarAutosizeSettings.dotWidth);var allDotsVisible=(visibleDots>=totalDots);$('#media-modal .pagNavBtn').toggleClass('hidden',allDotsVisible);$('#paginationDotContainer').width(finalDotBarWidth);setDotCount(visibleDots);}}
function _init(){if(_didInit){return;}
_didInit=true;$('#media-modal').on('soe.updateDot',function(evt,dot){var $allDots=$('#dotOverflowContainer .dot');var $visibleDots=$allDots.filter(':not(.filtered)');$('#media-modal-image').attr('src',_imageInfo[dot].imageUrl);$('#mediaModalHeader .mediaNum').text($visibleDots.index($allDots.eq(dot))+1);_updateDotPos(dot);});$('#media-modal').on('soe.arrowClick',function(evt,dir){var $allDots=$('#dotOverflowContainer .dot');var $visibleDots=$allDots.filter(':not(.filtered)');var selectedVisibleDot=$visibleDots.index($allDots.filter('.active'))+1;var selectedDot;if(dir==='next'){if(selectedVisibleDot<$visibleDots.length){selectedVisibleDot++;}else{selectedVisibleDot=1;}}else if(selectedVisibleDot>1){selectedVisibleDot--;}else{selectedVisibleDot=$visibleDots.length;}
selectedDot=$allDots.index($visibleDots.eq(selectedVisibleDot-1));$('#media-modal-image').attr('src',_imageInfo[selectedDot].imageUrl);$('#mediaModalHeader .mediaNum').text(selectedVisibleDot);_updateDotPos(selectedDot);});$('#media-modal').on('click','.pagDot',function(){var idx=$('#dotOverflowContainer .pagDot').index(this);$('#media-modal').trigger('soe.updateDot',idx);});$('#media-modal').on('keydown',function(key){if(key.which===37){$('#media-modal').trigger('soe.arrowClick','prev');}else if(key.which===39){$('#media-modal').trigger('soe.arrowClick','next');}});$('.modalTraverse').on('click',function(){$('#media-modal').trigger('soe.arrowClick',this.getAttribute('rel'));});$('#media-modal').on('mouseenter','.pagDot',function(){var $this=$(this);var idx=$('#dotOverflowContainer .pagDot').index($this);var dotWidth=parseInt($this.outerWidth(true),10)/2;var dotLeft=$this.offset().left;var tooltip=$('#paginationImages');if(!tooltip.hasClass('hidden')){var tooltipWidth=parseInt(tooltip.outerWidth(),10)/2;tooltip.stop().animate({left:(dotLeft+dotWidth)-tooltipWidth},'fast');$('#paginationImgSlider').stop().animate({left:idx* -parseInt(tooltip.width(),10)},'fast');tooltip.show();}});$('#media-modal').on('mouseleave','.pagDot',function(){$('#paginationImages').hide();});$('.pagNavBtn').on('click',function(){var dotContainer=$('#dotOverflowContainer');var pageContainer=$('#paginationDotContainer');var pageWidth=pageContainer.width();var pages=Math.ceil(dotContainer.find('.dot:not(.filtered)').length/_numDots);var nextShift;var maxContainerShift=((pages-1)* -pageWidth);if(this.getAttribute('rel')==='next'){nextShift=parseInt(dotContainer.css('left'),10)-pageWidth;if(nextShift<maxContainerShift){dotContainer.stop().animate({left:0});}else{dotContainer.stop().animate({left:nextShift});}}else{nextShift=parseInt(dotContainer.css('left'),10)+pageWidth;if(nextShift>0){dotContainer.stop().animate({left:maxContainerShift});}else{dotContainer.stop().animate({left:nextShift});}}});$('#mediaModalFilter').on('click','.dropdown-menu a',function(e){e.preventDefault();if(_filterFunc){var $allDots,$visibleDots;var filterId=this.getAttribute('data-filter-id');$('#dotOverflowContainer .dot').each(function(dotIdx){$(this).toggleClass('filtered',!_filterFunc(_imageInfo[dotIdx].userId,filterId));});$allDots=$('#dotOverflowContainer .dot');$visibleDots=$allDots.filter(':not(.filtered)');$('#mediaModalHeader .mediaTotal').text($visibleDots.length);_autosizeDotBar();$('#media-modal').trigger('soe.updateDot',$allDots.index($visibleDots.eq(0)));}});$(document).on('hide.bs.modal','#media-modal.image-content',function(){if(_originalUrl&&window.history.replaceState){window.history.replaceState(null,document.title,_originalUrl);}
$(window).off('.mediaModal');_downloadListFunc=null;_filterFunc=null;_originalUrl=null;_imageInfo=null;});}
function _initYouTube(readyFn){if(_youTubeInitFinished){if(readyFn){readyFn();}
return;}
if(readyFn){$(document).on('onYouTubeIframeAPIReady',function(){readyFn();});}
if(_youTubeInitStarted){return;}
_youTubeInitStarted=true;$(document).on('show.bs.modal','#media-modal.video-content',function(){if($('#media-modal .modal-video-playlist ul li').length<=0){youTubePlayer=new YT.Player($('#media-modal .modal-video-replace').get(0),{width:'100%',height:'100%',host:'https://www.youtube-nocookie.com',playerVars:{autoplay:1,theme:'dark',color:'black',rel:0,wmode:'opaque'},videoId:$(this).data('youtube-video-id'),events:{onReady:videoReady,onStateChange:videoStateChange,onError:videoError}});}else{startPlaylist();}});function videoReady(e){$(document).trigger('onYouTubeReady',e);}
function videoStateChange(e){$(document).trigger('onYouTubeStateChange',e);}
function videoError(e){$(document).trigger('onYouTubeError',e);}
function startPlaylist(){youTubePlayer=new YT.Player($('#media-modal .modal-video-replace').get(0),{host:'https://www.youtube-nocookie.com',playerVars:{autoplay:1,theme:'dark',color:'black',rel:0,wmode:'opaque'},events:{onReady:playlistReady,onStateChange:playlistStateChange,onError:playlistError}});}
function playlistReady(e){var playlist=_.pluck(_youTubeVideos,'id');var startVideo=$('#media-modal.video-content').data('youtube-video-id');$('#media-modal .modal-video-playlist').data('youtube-fail-count',0);youTubePlayer.loadPlaylist(playlist.join(','),playlist.indexOf(startVideo));$(document).trigger('onYouTubeReady',e);}
function playlistStateChange(e){var currentVideoIndex;if(e.data===YT.PlayerState.PLAYING){currentVideoIndex=youTubePlayer.getPlaylistIndex();$('#media-modal .modal-video-playlist a').removeClass('now-playing').eq(currentVideoIndex).addClass('now-playing');$('#media-modal .modal-video-details .title').text(_youTubeVideos[currentVideoIndex].title);$('#media-modal .modal-video-details .username').attr('href','https://www.youtube.com/channel/'+_youTubeVideos[currentVideoIndex].channelId).text(_youTubeVideos[currentVideoIndex].username);$('#media-modal .modal-video-details .date').text(_youTubeVideos[currentVideoIndex].timestamp.toDateString());showPlaylistPage(Math.floor(currentVideoIndex/_numVideoThumbs));}
$(document).trigger('onYouTubeStateChange',e);}
function playlistError(e){var failureCount;if(e.data===5){failureCount=$('#media-modal .modal-video-playlist').data('youtube-fail-count');if(failureCount<YOUTUBE_FAILURE_RETRY_COUNT){youTubePlayer.stopVideo();$('#media-modal .modal-video-replace').after('<div class="modal-video-replace"></div>').remove();$('#media-modal .modal-video-playlist').data('youtube-fail-count',failureCount+1);$('#media-modal').data('youtube-video-id',_youTubeVideos[youTubePlayer.getPlaylistIndex()].id);startPlaylist();}}
$(document).trigger('onYouTubeError',e);}
function showPlaylistPage(page){$('#media-modal .modal-video-playlist ul').data('page',page).css('margin-left',(page* -100)+'%');}
function getPlaylistPage(){return $('#media-modal .modal-video-playlist ul').data('page');}
$(document).on('hide.bs.modal','#media-modal.video-content',function(){try{youTubePlayer.stopVideo();youTubePlayer.destroy();youTubePlayer=null;}catch(e){}
$('#media-modal .modal-video').empty();_youTubeVideos=null;});$(document).on('click','#media-modal.video-content .modal-video-playlist a',function(){var selectedIndex=$('#media-modal .modal-video-playlist a').index(this);youTubePlayer.playVideoAt(selectedIndex);});$(document).on('click','#media-modal.video-content .playlist-pag-prev, #media-modal.video-content .playlist-pag-next',function(){var newPage,currentPage=getPlaylistPage(),firstPage=0,lastPage=(Math.ceil(_youTubeVideos.length/_numVideoThumbs)-1);if($(this).hasClass('playlist-pag-prev')){newPage=currentPage<=firstPage?lastPage:(currentPage-1);}else{newPage=currentPage>=lastPage?firstPage:(currentPage+1);}
showPlaylistPage(newPage);});window.onYouTubeIframeAPIReady=function(e){_youTubeInitFinished=true;$(document).trigger('onYouTubeIframeAPIReady',e);};}
function setDotCount(numDots){if(numDots>0){_numDots=numDots;}}
function setAutosizeDotBar(options){if(options){var defaults={maxWidth:0.7,dotWidth:1};_dotBarAutosizeSettings=$.extend({},defaults,options);}else{_dotBarAutosizeSettings=null;}}
function setupGroup(options){var defaults={container:null,selector:'a',hidePaginationThumbs:false,permalinkAttribute:null,userIdAttribute:null};var _options=$.extend({},defaults,options);_init();$(_options.container).on('click',_options.selector,function(e){var i,imageInfo=[];var localOptions=$.extend({},_options);var $allItems=$(localOptions.container).find(localOptions.selector);for(i=0;i<$allItems.length;++i){imageInfo.push({imageUrl:$allItems[i].getAttribute('href'),thumbUrl:localOptions.hidePaginationThumbs?null:$allItems.eq(i).find('img').attr('src'),userId:localOptions.userIdAttribute?$allItems[i].getAttribute(localOptions.userIdAttribute):null,permalinkUrl:localOptions.permalinkAttribute?$allItems[i].getAttribute(localOptions.permalinkAttribute):null});}
localOptions.hasPermalinks=Boolean(localOptions.permalinkAttribute);localOptions.hasThumbs=!localOptions.hidePaginationThumbs;localOptions.imageInfo=imageInfo;localOptions.initialItem=$allItems.index(this);showGroup(localOptions);e.preventDefault();});}
function showGroup(options){var defaults={typeName:null,containY:false,centerY:false,hasThumbs:false,hasPermalinks:false,downloadListFunc:null,filterList:null,filterFunc:null,initialItem:0,imageInfo:[]};var i,dotContainerWidth,dotMarkup='',paginationMarkup='';var _options=$.extend({},defaults,options);var dotTemplate=$('#tpl-pagination-dot').html();var filterTemplate=_.template($('#tpl-media-filter-list-item').html());var hasDownloads=(typeof _options.downloadListFunc==='function');var hasFilters=Boolean((_options.filterList&&options.filterList.length>0&&typeof _options.filterFunc==='function'));_init();_imageInfo=_options.imageInfo;$('#mediaModalHeader .mediaType').text(_options.typeName);$('#mediaModalHeader .mediaNum').text(_options.initialItem+1);$('#mediaModalHeader .mediaTotal').text(_options.imageInfo.length);$('#media-modal-image').attr('src',_options.imageInfo[_options.initialItem].imageUrl);$('#mediaModalDownload').toggleClass('hidden',!hasDownloads);$('#mediaModalFilter').toggleClass('hidden',!hasFilters);$('#dotOverflowContainer').empty().width(9999999);$('#paginationImgSlider').empty();$('#paginationImages').toggleClass('hidden',!_options.hasThumbs);for(i=0;i<_options.imageInfo.length;++i){dotMarkup+=dotTemplate;if(_options.hasThumbs){paginationMarkup+='<img src="'+_options.imageInfo[i].thumbUrl+'"/>';}}
$('#dotOverflowContainer').append($(dotMarkup));$('#paginationImgSlider').width(9999999).append($(paginationMarkup));$('#dotOverflowContainer .dot').eq(_options.initialItem).addClass('active');if(_options.hasPermalinks){_originalUrl=window.location.href;_updatePermalink(_options.initialItem);}
if(hasDownloads){_downloadListFunc=_options.downloadListFunc;_updateDownloadList(_options.initialItem);}
if(hasFilters){_filterFunc=_options.filterFunc;$('#mediaModalFilter ul').empty();for(i=0;i<_options.filterList.length;++i){$('#mediaModalFilter ul').append($(filterTemplate({filterId:_options.filterList[i].id,filterTitle:_options.filterList[i].title})));}}
if(_dotBarAutosizeSettings){$(window).on('resize.mediaModal',_autosizeDotBar);_autosizeDotBar();}
dotContainerWidth=$('#paginationDotContainer').width();$('#dotOverflowContainer').css('left',(Math.ceil((_options.initialItem+1)/_numDots)-1)* -dotContainerWidth);$('#media-modal').removeClass().addClass('modal fade image-content');$('#media-modal').toggleClass('contain-y',_options.containY);$('#media-modal').toggleClass('center-y',_options.centerY);$('#media-modal').modal();}
function setupPoster(options){var defaults={container:null,selector:'a'};var _options=$.extend({},defaults,options);_init();$(_options.container).on('click',_options.selector,function(event){showPoster($.extend({},_options,{url:this.getAttribute('href')}));event.preventDefault();});}
function showPoster(options){var defaults={scroll:true,containY:false};var _options=$.extend({},defaults,options);_init();$('#media-modal-image').attr('src',_options.url);$('#media-modal').removeClass().addClass('modal fade image-content');$('#media-modal').toggleClass('full-scroll',_options.scroll);$('#media-modal').toggleClass('full-fixed',!_options.scroll);$('#media-modal').toggleClass('contain-y',_options.containY);$('#media-modal').modal();}
function setTrayThumbCount(thumbsPerPage){if(thumbsPerPage>0){_numVideoThumbs=thumbsPerPage;}}
function findYouTubeId(url){var idSniff=/(?:youtube\.com\/(?:[^/]+\/.+\/|(?:v|e(?:mbed)?)\/|.*[?&]v=)|youtu\.be\/)([^"&?/ ]{11})/i;var matches=url.match(idSniff);if(matches&&matches.length>=2){return matches[1];}else{return null;}}
function setupYouTube(options){if(!globs.wdl.wdlCookDNT){_initYouTube(function(){var defaults={linkSelector:null,defaultVideoID:null};var _options=$.extend({},defaults,options);$(document).on('click',_options.linkSelector,function(event){var videoID;if($(window).width()>=768){event.preventDefault();videoID=findYouTubeId(this.getAttribute('href'))||_options.defaultVideoID;showYouTube({videoId:videoID});}});});}}
function showYouTube(options){if(!globs.wdl.wdlCookDNT){_initYouTube(function(){var defaults={videoId:null,videos:null};var i,playlistTemplate,playlistContents;var _options=$.extend({},defaults,options);var $modal=$('#media-modal');if(youTubePlayer){youTubePlayer.stopVideo();youTubePlayer.destroy();youTubePlayer=null;}
$modal.data('youtube-video-id',_options.videoId);$modal.find('.modal-video').html($('#tpl-youtube-video-default-markup').html());if(_options.videos&&_options.videos.length>0){playlistTemplate=_.template($('#tpl-youtube-playlist-item').html());playlistContents='';for(i=0;i<_options.videos.length;++i){playlistContents+=playlistTemplate(_options.videos[i]);}
_youTubeVideos=_options.videos;$modal.find('.modal-video-playlist ul').html(playlistContents).data('page',0);$modal.find('.modal-video-playlist .playlist-count').text(_options.videos.length);$modal.removeClass().addClass('modal fade video-content playlist');$modal.modal();}else{$modal.removeClass().addClass('modal fade video-content in');$modal.modal();}});}}
function isReady(){return _youTubeInitFinished;}
return{setDotCount:setDotCount,setAutosizeDotBar:setAutosizeDotBar,setupGroup:setupGroup,showGroup:showGroup,setTrayThumbCount:setTrayThumbCount,setupYouTube:setupYouTube,showYouTube:showYouTube,setupPoster:setupPoster,showPoster:showPoster,findYouTubeId:findYouTubeId,isReady:isReady};}());

/* end /web-platform/scripts/web-platform/component/media-modal.js*/

/* start /scripts/components/newsletter-modal.js*/
$(document).ready(function(){'use strict';var sawNewsletterModal,cookieName;var modalTriggers=['1066639','1066640'];if(modalTriggers.indexOf(globs.urlparameters.cid)>=0){cookieName='h1z1SawNewsletterModal'+globs.urlparameters.cid;sawNewsletterModal=wpCookie(cookieName);if(!sawNewsletterModal){$(document).on('click','#newsletterModalBox .email-signup-submit',function(e){e.preventDefault();var cid=globs.urlparameters.cid;var $emailBox=$('#newsletterModalBox');h1z1.emailSignup.processForm(cid,$emailBox);});wpCookie(cookieName,true,30);$('#newsletterModal').modal();}}});

/* end /scripts/components/newsletter-modal.js*/

/* start /scripts/components/external-warning-modal.js*/
$(document).ready(function(){'use strict';$(document).on('click','.external-link-warning',function(e){e.preventDefault();$('#externalWarningProceedLink').attr('href',$(e.target).attr('href'));$('#externalWarningModal').modal();});$(document).on('click','#externalWarningProceedLink',function(){$('#externalWarningModal').modal('hide');});});

/* end /scripts/components/external-warning-modal.js*/
